<template>
<div><br><br>
  <div>
    <el-button type="primary" @click="newWallet">新建钱包</el-button>
  </div><br><br>
  <div>
    <el-input style="width: 800px" placeholder="请输入助记词" v-model="mnemonic">
      <template slot="prepend">助记词：</template>
    </el-input>
    <el-button type="primary" @click="newAccount">新建账户</el-button>
  </div>
  <div>
  <el-descriptions column=1 title="新建 钱包和主账户信息">
    <el-descriptions-item label="助记词">{{walletInfo.mnemonic}}</el-descriptions-item>
    <el-descriptions-item label="私钥">{{walletInfo.privateKey}}</el-descriptions-item>
    <el-descriptions-item label="公钥">{{walletInfo.publicKey}}</el-descriptions-item>
    <el-descriptions-item label="地址">{{walletInfo.address}}</el-descriptions-item>
    <el-descriptions-item label="账户地址">{{walletInfo.accountPath}}</el-descriptions-item>
  </el-descriptions>
  </div><br><br>
  <div>
    <el-descriptions column=1 title="新建子账户信息">
      <el-descriptions-item label="私钥">{{accountInfo.privateKey}}</el-descriptions-item>
      <el-descriptions-item label="公钥">{{accountInfo.publicKey}}</el-descriptions-item>
      <el-descriptions-item label="地址">{{accountInfo.address}}</el-descriptions-item>
      <el-descriptions-item label="账户地址">{{accountInfo.accountPath}}</el-descriptions-item>
    </el-descriptions>
  </div>

</div>
</template>

<script>
export default {
  name: "newWallet",
  data() {
    return {
        walletInfo: '',
        mnemonic: '',
        accountInfo: '',
    }
  },
  methods: {
    //点击更新按钮请求账户列表
    newWallet() {
      //发送请求
      this.axios.get("/newHDWallet").then(res => {
        this.walletInfo = res.data;
      })
    },
    newAccount() {
      //发送请求
      this.axios.post("/newHDAccount",this.mnemonic).then(res => {
        this.accountInfo = res.data;
      })
    },
  }
}



</script>

<style scoped>

</style>
